<div class="span-12">
	    <% if flash[:error] %>
      <div class="error"><%= flash[:error] %></div>
    <% end %>

	<h3>Antrag <%= @proposal.longId %></h3>
	
	<h4><%=h @proposal.title %>
	</h4>
	
	<p>
	  <b>Description:</b><br>
	  <%= simple_format(@proposal.description)
		 %>
	</p>
	
	<hr>
	<p><b>Email</b>:
	<%= @proposal.email %>
	</p>
	<p class=""><b>Status</b>:
	<%= @proposal.status %>

	</p>
	<hr>
	
	
	<table>
	  <tr>
	    <th>Dateien</th>

	  </tr>


  <% @documents.each do |document| %>
	  <tr>
	    <td>
				<%= link_to document.document_file_name, document.document.url %> <%= number_to_human_size(document.document_file_size) %>
			</td>
	  </tr>
	<% end %>



</table>

<% unless @proposal.status ==  ("new" || "submitted") %>
	<h3>Reviews</h3>
	<table>
		<tr>
			<th>Reviewer</th>
			<th>Entscheid</th>
			<th>Begründung</th>
		</tr>
		<% @reviews.each do |r| %>
			<tr>
				<td>
					<% @user = User.find(:first, :conditions => { :id  => r.user_id.to_s }) %>
					<%= @user.name %>
				</td>
				<td>
					<%= r.decision %></td>
				<td>
					<%= r.review %></td>
			</tr>
		<% end %>
	  </table>
<% end%>

<% form_for @proposal, :url => { :action => :save_note, :controller => :admin, :proposal_id => @proposal.id.to_s} do |form| %>
	<h3>Notizen</h3>
	<%= form.text_area :note %>
	<%= form.submit %>
<% end %>

</div>
<div class="span-6 last">

<h3>Reviewers</h3>

<% if @proposal.status == "submitted" %>
	
	<% @users.each do |user| %>
		<% if user.assigned(@proposal) == true %>
				<% form_for :review, :url => { :action => :delete, :controller => :admin, :proposal_id => @proposal.id.to_s, :user_id => user.id.to_s} do |form| %>
				<b class="selected"><%= user.name %> </b>
				<%= form.submit "Unassign", :class => "link" %>
		
			<br>
		    <% end %>
	
		<% else %>
			<% form_for :review, :url => { :action => :create_review, :controller => :admin, :proposal_id => @proposal.id.to_s, :user_id => user.id.to_s} do |form| %>
			<%= user.name %> 
			<%= form.submit "Assign", :class => "link" %>
		
			<br>
		    <% end %>
		
		<% end %>
	
	<% end %>
	<br>
	<%= button_to "Review starten", {:action => :start_review, :id => @proposal}, :confirm => "Sind sie sicher?\n(alle erhalten eine Emailbenachrichtigung)" %>

<% else %>

	<% @users.each do |user| %>
		<% if user.assigned(@proposal) == true %>
				<b class="selected"><%= user.name %> </b>
				<br>
	
		
		<% end %>
	
	<% end %>
	<br>
<% end %>



</div>
